home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / jazlib.arc / POKEB.ASM < prev    next >
Assembly Source File  |  1988-12-18  |  1KB  |  58 lines

  1. Comment *
  2. ┌────────────────────────────────────────────────────────────────────────────┐
  3. │pokeb                                         │
  4. │Poke a byte into memory                             │
  5. │                                         │
  6. │Synopsis                                     │
  7. │   int seg = 0xb800,ofs = 0;                             │
  8. │                                         │
  9. │   pokeb(seg,ofs,'A');           (write the letter "A" to the first byte    │
  10. │                   of screen memory)                 │
  11. └────────────────────────────────────────────────────────────────────────────┘
  12. *
  13.  
  14. ;=============================================================================
  15. ;                    Data
  16. ;=============================================================================
  17.  
  18. DGROUP    group    _DATA
  19. _DATA    segment word public 'DATA'
  20.     assume    ds:DGROUP
  21.  
  22.     ; Your Data goes here . . .
  23.  
  24. _DATA    ends
  25.  
  26. ;=============================================================================
  27. ;                   Code
  28. ;=============================================================================
  29.  
  30.     assume cs:_text
  31. _text    segment public byte 'code'
  32.     PUBLIC _pokeb
  33.  
  34. _pokeb        proc near
  35.  
  36.     push bp             ; save base of stack
  37.     mov bp,sp            ; establish stack frame
  38.  
  39.     push di             ; save MS-C's Register vars
  40.     push es
  41.  
  42.     mov ax,[bp].8            ; get value to poke
  43.     mov di,[bp].6            ; get offset
  44.     push [bp].4            ; segment
  45.     pop es
  46.     stosb
  47.  
  48.     pop es                ; restore data and extra segs
  49.     pop di                ; Restore MS-C's Register vars
  50.  
  51.     mov sp,bp            ; restore stack pointer
  52.     pop  bp             ; and base of stack
  53.     ret                ; return to caller
  54.  
  55. _pokeb        endp
  56. _text    ends
  57. end
  58.